
select @DatabaseVersion = CAST(value AS nvarchar(2000)) from 
::fn_listextendedproperty('DatabaseVersionNumber', null,
 null, null, null, null, null)
	
IF @@rowcount = 0 set @DatabaseVersion = '1.0'

